import {defineStore} from "pinia";
import store from "../data";

export const useUserStore = defineStore('user', {
    state: () => ({
        Profile: {
            "ip": "",
            "profile": {
                "id": 0,
                "updated_at": 0,
                "role_id": 0,
                "role": {"id": 0, "key": "", "name": ""},
                "coin": 0
            },
            "user": {
                "id": 1,
                "created_at": 0,
                "username": "",
                "lock": 0,
                "profile": null,
                "vip": 0,
                "admin_name": ""
            }
        },
    }),
    actions: {
        updateProfile(profile: any) {
            this.Profile = profile
        }
    }
})

export function getUserStore() {
    return useUserStore(store)
}